import React, { Component } from 'react'
import { connect } from 'react-redux'
import { createAddMsg } from '../../redux/actions/count_action'
class Count extends Component {
    add = () => {
        this.props.jiafa(1)
    }
    render() {
        return (
            <div>
                <h2>当前的数据为{this.props.he}</h2>
                <button onClick={this.add}>加一</button>
            </div>
        )
    }
}

export default connect(
    state => ({ he: state.he }), // 映射状态
    { jiafa: createAddMsg }// 映射操作状态的方法
)(Count)